package org.wu.framework.authorization.platform.application.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.wu.framework.authorization.platform.application.SysDictionaryDataApplication;
import org.wu.framework.authorization.platform.application.assembler.SysDictionaryDataDTOAssembler;
import org.wu.framework.authorization.platform.application.command.SysDictionaryDataCommand;
import org.wu.framework.authorization.platform.domain.model.sys.dictionary.data.SysDictionaryData;
import org.wu.framework.authorization.platform.domain.model.sys.dictionary.data.SysDictionaryDataRepository;
import org.wu.framework.lazy.orm.core.persistence.reverse.lazy.ddd.DefaultDDDLazyApplicationImpl;
import org.wu.framework.lazy.orm.web.plus.stereotype.LazyApplication;
import org.wu.framework.web.response.Result;

import java.util.List;

/**
 * describe
 *
 * @author Jia wei Wu
 * @date 2023/05/17 11:19 晚上
 * @see DefaultDDDLazyApplicationImpl
 **/
@LazyApplication
public class SysDictionaryDataApplicationImpl implements SysDictionaryDataApplication {

    @Autowired
    SysDictionaryDataRepository sysDictionaryDataRepository;

    /**
     * describe 新增
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/

    @Override
    public Result<SysDictionaryData> save(SysDictionaryDataCommand sysDictionaryDataCommand) {
        SysDictionaryData sysDictionaryData = SysDictionaryDataDTOAssembler.toDictionaryData(sysDictionaryDataCommand);
        return sysDictionaryDataRepository.story(sysDictionaryData);
    }

    /**
     * describe 更新
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/

    @Override
    public Result<SysDictionaryData> update(SysDictionaryDataCommand sysDictionaryDataCommand) {
        SysDictionaryData sysDictionaryData = SysDictionaryDataDTOAssembler.toDictionaryData(sysDictionaryDataCommand);
        return sysDictionaryDataRepository.story(sysDictionaryData);
    }

    /**
     * describe 查询单个
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/

    @Override
    public Result<SysDictionaryData> findOne(SysDictionaryDataCommand sysDictionaryDataCommand) {
        SysDictionaryData sysDictionaryData = SysDictionaryDataDTOAssembler.toDictionaryData(sysDictionaryDataCommand);
        return sysDictionaryDataRepository.findOne(sysDictionaryData);
    }

    /**
     * describe 查询多个
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/

    @Override
    public Result<List<SysDictionaryData>> findList(SysDictionaryDataCommand sysDictionaryDataCommand) {
        SysDictionaryData sysDictionaryData = SysDictionaryDataDTOAssembler.toDictionaryData(sysDictionaryDataCommand);
        return sysDictionaryDataRepository.findList(sysDictionaryData);
    }

    /**
     * describe 删除
     *
     * @param
     * @return
     * @exception/throws
     * @author Jia wei Wu
     * @date 2023/05/17 11:19 晚上
     **/

    @Override
    public Result<SysDictionaryData> delete(SysDictionaryDataCommand sysDictionaryDataCommand) {
        SysDictionaryData sysDictionaryData = SysDictionaryDataDTOAssembler.toDictionaryData(sysDictionaryDataCommand);
        return sysDictionaryDataRepository.delete(sysDictionaryData);
    }

}